package circuits;

import java.util.Iterator;

public class AndOperator extends Operator{

	@Override
	protected void calculateResult() {
		Iterator<Operation> operandsIterator = this.operands.iterator();
		boolean andResult = true;
		while (operandsIterator.hasNext()){
			Operation operand = operandsIterator.next();
			if (operand.result == false){
				andResult = false;
				break;
			}
		}
		this.setResultAndNotifyListeners(andResult);
	}
}
